package br.ufpe.cin.imlm2.jbeat.soot.throwableset.propagation;

import java.util.Map;

import br.ufpe.cin.imlm2.jbeat.soot.common.CommonOptions;
import br.ufpe.cin.imlm2.util.options.NoSuchOptionException;
import br.ufpe.cin.imlm2.util.options.Option;
import br.ufpe.cin.imlm2.util.options.ParsingException;

public class PropagationOptions extends CommonOptions {

	public static final String STATIC_INITIALIZERS = "staticInitializers";
	public static final String SYNTHETIC_ENTITIES = "syntheticMethods";
	public static final String PROPAGATE_STD_LIBRARIES = "propagatedStbLibs";
	public static final String ONLY_REACHABLES = "onlyReachables";
	public static final String PROPAGATES_TO = "propagatesTo";

	public PropagationOptions() {
		super();
		this.addOption( new Option( STATIC_INITIALIZERS, "clinits",
				"Defines whether or not static initializers (clinits) should be considered"
						+ " in the analysis.", Boolean.FALSE ) );
		this.addOption( new Option( SYNTHETIC_ENTITIES, "synthetics",
				"Defines whether or not synthetic methods should be considered in the analysis.",
				Boolean.FALSE ) );
		this.addOption( new Option( PROPAGATE_STD_LIBRARIES, null,
				"Defines whether or not methods from the standard Java libraries should "
						+ "be considered during exception propagation.", Boolean.TRUE ) );
		this.addOption( new Option( ONLY_REACHABLES, null, "If set to true the analysis"
				+ " will only consider reachable methods.", Boolean.TRUE ) );
		this.addOption(new Option(PROPAGATES_TO,null,"Save the propagates to set of a method.",Boolean.TRUE));

	}

	@Override
	public void parse( Map<String, String> options ) throws ParsingException, NoSuchOptionException {
		super.parse( options );
	}

	public boolean isStaticInitializers() {
		return (Boolean) this.getOptionInternal( STATIC_INITIALIZERS ).getValue();
	}

	public boolean isSyntheticEntities() {
		return (Boolean) this.getOptionInternal( SYNTHETIC_ENTITIES ).getValue();
	}

	public boolean isPropagatedStdLibs() {
		return (Boolean) this.getOptionInternal( PROPAGATE_STD_LIBRARIES ).getValue();
	}

	public boolean isOnlyReachables() {
		return (Boolean) this.getOptionInternal( ONLY_REACHABLES ).getValue();
	}

	public boolean isPropagatesTo(){
		return (Boolean) this.getOptionInternal(PROPAGATES_TO).getValue();
	}
}
